<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: ylq
  Date: 2017/6/12
  Time: 14:50
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>Bootstrap 101 Template</title>
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link href="${pageContext.request.contextPath}/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- 可选的Bootstrap主题文件（一般不用引入） -->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/bootstrap-3.3.7-dist/css/bootstrap-theme.min.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/main.css"/>
    <!--[if lte IE 9]>

    <script src="${pageContext.request.contextPath}/bootstrap-3.3.7-dist/js/respond.min.js"></script>
    <script src="${pageContext.request.contextPath}/bootstrap-3.3.7-dist/js/html5shiv.min.js"></script>
    <![endif]-->
</head>

<body>
<%@include file="/WEB-INF/jsp/common/native.jsp" %>

<div class="col-sm-9 col-md-10  main" id="mymain">
    <c:import url="carousel/carousel.jsp"/>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="${pageContext.request.contextPath}/bootstrap-3.3.7-dist/js/jquery.min.js"></script>

<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="${pageContext.request.contextPath}/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>

<script style="text/javascript">
    //自定义导航操作对象
    window.navigate = (function () {
        var obj = {};
        obj.navChange = function (e) {
//            $("#carousel-example-generic").hide();
            $("#accordion a").removeClass("_active");
            $(e).addClass("_active");
            if ($(e).attr("data-href") !== "#") {
                //$("#mymain").load($(e).attr("data-href"));
                window.ajaxloader.load("mymain", $(e).attr("data-href"));
            }

        };
        return obj;
    })();

    //自定义主页内容加载操作对象
    window.ajaxloader = (function () {
        var obj = {};
        //id:操作的载入对象id
        //url:待装入 HTML 网页网址。
        //data:发送至服务器的 key/value 数据
        //callback:载入成功时回调函数。
        obj.load = function (id, url, data, callback) {
            $("#" + id).html('<img id="ajax-loader" src="img/ajax-loader.gif" style="margin:20% auto;display:block;">');
            $("#" + id).load(url, data, callback);
        };
        return obj;
    })();

    //初始化DOM操作绑定事件
    $(document).ready(function () {
        $("#accordion a").each(function () {
            $(this).on("click", function () {
                window.navigate.navChange(this);
            });
        });
    })

</script>
</body>
</html>